@extends('admin.layout')
@section('title',$title)
@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                商铺管理
                <small>这是后台管理页</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 商铺管理</a></li>
                {{--<li><a href="#"></a></li>--}}
                <li class="active">商铺编辑</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">商铺编辑</h3>
                            <!-- 商铺编辑失败提示信息 -->
                            @if (session('error'))
                                <div class="alert alert-danger alert-dismissable">
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                    <h4><i class="icon fa fa-ban"></i> 警告!</h4>
                                            <li>{{ session('error') }}</li>
                                </div>
                            @endif
                            <!-- 商铺名已存在提示框 -->
                             @if (session('oldusername'))
                                <div class="alert alert-danger alert-dismissable">
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                    <h4><i class="icon fa fa-ban"></i> 警告!</h4>
                                            <li>{{ session('oldshopname') }}</li>
                                </div>
                            @endif
                            <!-- 错误提示框 -->
                            @if (count($errors) > 0)
                                <div class="alert alert-danger alert-dismissable">
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                    <h4><i class="icon fa fa-ban"></i> 警告!</h4>
                                    <ol>
                                        @foreach ($errors->all() as $error)
                                            <li>{{ $error }}</li>
                                        @endforeach
                                    </ol>
                                </div>
                            @endif
                            <!-- 错误提示框结束 -->

                        </div><!-- /.box-header -->
                        <!-- 商铺编辑表单 start -->
                        <form role="form" action="/admin/shop/update" method="post" enctype="multipart/form-data">
                            <!-- 隐藏域 -->
                            {{ csrf_field() }}
                            <div class="box-body">
                            <input type="hidden" name="id" value="{{$data -> id}}">
                            <input type="hidden" name="oldlogo" value="{{$data -> logo}}">
                                <!-- 商铺名 -->
                                <div class="form-group">
                                    <label for="exampleInputEmail1">商铺名</label>
                                    <input type="text" name="shopname" value="{{ $data -> shopname }}" class="form-control" id="exampleInputEmail1"
                                           placeholder="请输入商铺名">
                                </div>
                                
                                <!-- 用户ID -->
                                <div class="form-group">
                                    <label for="exampleInputEmail1">店主姓名</label>
                                    <input type="text" name="dzname" class="form-control" id="exampleInputEmail1" value="{{ $data -> dzname }}" placeholder="请输入真实姓名">
                                           
                                </div>
                                <!-- 商铺名 -->
                                <div class="form-group">
                                    <label for="exampleInputEmail1">店主手机</label>
                                    <input type="text" name="dzphone" value="{{ $data -> dzphone }}" class="form-control" id="exampleInputEmail1"
                                           placeholder="请输入手机号">
                                </div>
                                <!-- QQ -->
                                <div class="form-group">
                                    <label for="exampleInputEmail1">QQ</label>
                                    <input type="text" name="qq" class="form-control" value="{{ $data -> qq }}" id="exampleInputEmail1"  placeholder="请输入QQ号">
                                           
                                </div>
                                 <!-- 营业模式 -->
                                <div class="form-group">
                                    <label>营业模式</label>
                                    <select class="form-control" name="way">
                                        <option 
                                        @if($data -> way  == 0)
                                            selected
                                        @endif
                                        value="0">自营</option>
                                        <option 
                                        @if($data -> way  == 1)
                                            selected
                                        @endif
                                        value ="1">外驻</option>
                                    </select>
                                </div>
                                <!-- 用户ID -->
                                <div class="form-group">
                                    <label for="exampleInputEmail1">卖家ID</label>
                                    <input type="text" name="seller_id" value="{{ $data -> seller_id }}" class="form-control" id="exampleInputEmail1"  placeholder="请输入卖家ID">
                                           
                                </div>
                                 <!-- logo上传 -->
                                <div class="form-group">
                                    <label for="exampleInputFile">店铺LOGO</label>
                                    <img src="{{ $data -> logo }}" width="200">
                                    <input type="file" name="logo" id="exampleInputFile">
                                    <p class="help-block">请上传LOGO</p>
                                </div>
                                <!-- 店铺的状态 -->
                                <div class="form-group">
                                    <label>店铺状态</label>
                                    <select class="form-control" name="shopstatus">
                                        <option 
                                        @if($data -> shopstatus  == 0)
                                            selected
                                        @endif
                                        value="0">开业</option>
                                        <option 
                                        @if($data -> shopstatus  == 1)
                                            selected
                                        @endif
                                        value ="1">停业</option>
                                    </select>
                                </div>
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <!-- 提交按钮 -->
                                <button type="submit" class="btn btn-primary">编辑</button>
                                <!-- 重置按钮 -->
                                <button type="reset" class="btn btn-danger">重置</button>
                            </div>
                        </form>
                    </div><!-- /.box -->
                    <!-- 商铺编辑表单 end -->






                </div><!--/.col (left) -->
                <!-- right column -->

            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection
